#pragma once
#include <iostream>
#include <memory>
#include "Socket.hpp"
#include "Connection.hpp"
#include "InetAddr.hpp"
class Listener
{
public:
    Listener(int port):_port(port),_listen_socket(std::make_unique<TcpSocket>(port))
    {

    }
    void Init()
    {
        _listen_socket->BuildTcpSocket();
    }
    int ListenSockfd()
    {
        return _listen_socket->Fd();
    }
    int Accepter(InetAddr* client)
    {
        return _listen_socket->Accept(client);
    }
private:  
    int _port;
    std::unique_ptr<Socket> _listen_socket;
};